Support DocumentSymbolProvider in CustomTextEditor#304909
Open
jogibear9988 wants to merge 6 commits intomicrosoft:mainfrom
Open
Support DocumentSymbolProvider in CustomTextEditor#304909jogibear9988 wants to merge 6 commits intomicrosoft:mainfrom
jogibear9988 wants to merge 6 commits intomicrosoft:mainfrom
Conversation
Contributor
Author
Contributor
Author
|
implementation would look like this: |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a new proposed API (customEditorOutline) that lets Custom Editor extensions provide outline data so VS Code can populate the Outline view, Breadcrumbs, and Go to Symbol for custom editors that don’t use a standard text model.
Changes:
- Adds the proposed
customEditorOutlineAPI surface (CustomEditorOutlineItem,CustomEditorOutlineProvider, andwindow.registerCustomEditorOutlineProvider). - Implements ext host ↔ main thread plumbing plus a workbench-side
IOutline<>implementation for custom editors, including per-item toolbar and context menu contribution points. - Extends the outline infrastructure to support per-outline context menus and context key overlays.
Reviewed changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/vscode-dts/vscode.proposed.customEditorOutline.d.ts | Adds the proposed extension API types and registration function. |
| src/vs/workbench/services/outline/browser/outline.ts | Extends outline config to support context menus + per-element context key overlays. |
| src/vs/workbench/services/actions/common/menusExtensionPoint.ts | Registers new proposed menu contribution points for custom editor outline toolbar/context menus. |
| src/vs/workbench/contrib/outline/browser/outlinePane.ts | Adds generic right-click context menu handling for outlines that opt in. |
| src/vs/workbench/contrib/customEditor/common/customEditorOutlineService.ts | Defines the provider service contract and DTO shape. |
| src/vs/workbench/contrib/customEditor/browser/customEditorOutline.ts | Implements the custom-editor-backed IOutline<> and registers an outline creator. |
| src/vs/workbench/contrib/customEditor/browser/customEditor.contribution.ts | Ensures the custom editor outline contribution is loaded. |
| src/vs/workbench/api/common/extHostCustomEditorOutline.ts | Ext host implementation: registers providers and converts outline items to DTOs. |
| src/vs/workbench/api/common/extHost.protocol.ts | Adds RPC shapes and proxy identifiers for custom editor outline support. |
| src/vs/workbench/api/common/extHost.api.impl.ts | Exposes window.registerCustomEditorOutlineProvider in the ext host API surface. |
| src/vs/workbench/api/browser/mainThreadCustomEditorOutline.ts | Main thread handler + singleton service bridging to the ext host provider. |
| src/vs/workbench/api/browser/extensionHost.contribution.ts | Wires the main thread participant into extension host contributions. |
| src/vs/platform/extensions/common/extensionsApiProposals.ts | Registers the customEditorOutline proposal name. |
| src/vs/platform/actions/common/actions.ts | Adds MenuIds for the custom editor outline toolbar and context menus. |
| custom-editor-outline.md | Adds documentation for the new proposed API and menu contribution points. |
src/vs/workbench/contrib/customEditor/browser/customEditorOutline.ts
Outdated
Show resolved
Hide resolved
a428452 to
de6741a
Compare
src/vs/workbench/contrib/customEditor/common/customEditorOutlineService.ts
Outdated
Show resolved
Hide resolved
Contributor
Author
|
@jrieken what do you think about this implementation? |
…Custom Editors can also populate the Outline view
1f2e284 to
fe178bf
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Support DocumentSymbolProvider in CustomTextEditor
Fixes #97095
Description
This PR adds a proposed extension API that allows Custom Editor extensions to provide outline data for the Outline view, Breadcrumbs, and Go to Symbol quick-pick. Previously, custom editors had no way to contribute to these features since they don't use a standard text model that a
DocumentSymbolProvidercan work with.New API
The proposed API
customEditorOutlineadds:CustomEditorOutlineItem— describes a node in the outline tree withid,label,detail,tooltip,icon,contextValue, andchildren.CustomEditorOutlineProvider— interface withprovideOutline(),revealItem(),onDidChangeOutline, andonDidChangeActiveItem.window.registerCustomEditorOutlineProvider(viewType, provider)— registers the provider for a specific custom editor view type.Features
provideOutline()→ they appear in the Outline view with icons, labels, and a tree hierarchy.onDidChangeActiveItem→ the outline highlights/follows the active node.revealItem(id)is called so the extension can scroll the webview.customEditor/outline/toolbarwith"group": "inline"in theirpackage.json.customEditor/outline/toolbarwithout theinlinegroup.customEditor/outline/context(separate from the toolbar menu).customEditorOutlineItemcontext key is set to each item'scontextValue, enabling conditional menu contributions.Two Separate Menu Contribution Points
package.jsonMenuIdcustomEditor/outline/toolbarCustomEditorOutlineActionMenucustomEditor/outline/contextCustomEditorOutlineContextArchitecture
Files Changed
New files
src/vscode-dts/vscode.proposed.customEditorOutline.d.tssrc/vs/workbench/api/common/extHostCustomEditorOutline.tssrc/vs/workbench/api/browser/mainThreadCustomEditorOutline.tssrc/vs/workbench/contrib/customEditor/common/customEditorOutlineService.tssrc/vs/workbench/contrib/customEditor/browser/customEditorOutline.tsIOutlineimplementation with custom tree renderer andIOutlineCreatorModified files
src/vs/workbench/api/common/extHost.protocol.tssrc/vs/workbench/api/common/extHost.api.impl.tsregisterCustomEditorOutlineProvideronwindownamespacesrc/vs/platform/extensions/common/extensionsApiProposals.tscustomEditorOutlineproposalsrc/vs/platform/actions/common/actions.tsMenuId.CustomEditorOutlineActionMenuandMenuId.CustomEditorOutlineContextsrc/vs/workbench/services/actions/common/menusExtensionPoint.tscustomEditor/outline/toolbarandcustomEditor/outline/contextmenu contribution pointssrc/vs/workbench/services/outline/browser/outline.tscontextMenuIdandgetContextKeyOverlaytoIOutlineListConfigsrc/vs/workbench/contrib/outline/browser/outlinePane.tssrc/vs/workbench/contrib/customEditor/browser/customEditor.contribution.tssrc/vs/workbench/api/browser/extensionHost.contribution.tsmainThreadCustomEditorOutlineHow to Test
CustomTextEditorProvider)."enabledApiProposals": ["customEditorOutline"]to the extension'spackage.json.vscode.window.registerCustomEditorOutlineProvider(viewType, provider)with an implementation that returns outline items.revealItem().onDidChangeActiveItemhighlights the node in the outline.customEditor/outline/toolbar, verify inline buttons appear on hover and respond towhenclauses usingcustomEditorOutlineItem.customEditor/outline/context, verify the right-click context menu appears with the correct items filtered bywhenclauses.